Generate a dictionary of numbers (1..N) in form (x, x*x)ΒΆ

Write a python script to generate and print a dictionary that contains
a number (between 1 and N) in the form (x, x * x).
Sample Dictionary:
N = 5
Expected output:
{1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
N = int(input("Input a number: "))
D = dict()

for k in range(1, N + 1):
    D[k] = k * k

print(D)

Output:

Input a number: 5
{1: 1, 2: 4, 3: 9, 4: 16, 5: 25}